package com.redare.dev.smart.generator.service.provider;

import com.redare.dev.smart.generator.service.provider.filetype.JavaFileType;
import com.redare.dev.smart.generator.service.provider.filetype.JsFileType;
import com.redare.dev.smart.generator.service.provider.filetype.KotlinFileType;
import com.redare.dev.smart.generator.service.provider.filetype.MdFileType;

/**
 * 文件提供者工厂
 */
public class FileProviderFactory {

    final private String outputPath;

    public FileProviderFactory(String outputPath) {
        this.outputPath = outputPath;
    }

    public AbstractFileProvider getInstance(String type) {
        if("java".equals(type)) {
            return new DefaultProviderImpl(outputPath, JavaFileType.INSTANCE);
        }
//        else if("sql".equals(type)) {
//            return new DefaultProviderImpl(outputPath, SqlFileType.INSTANCE);
//        } else if("xml".equals(type)) {
//            return new DefaultProviderImpl(outputPath, XmlFileType.INSTANCE);
//        }
        else if("kt".equals(type)) {
            return new DefaultProviderImpl(outputPath, KotlinFileType.INSTANCE);
        }
        else if ("js".equals(type)) {
            return new DefaultProviderImpl(outputPath, JsFileType.INSTANCE);
        }else {
            return new DefaultProviderImpl(outputPath, MdFileType.INSTANCE);
        }
    }
}